package com.asher.hmone.slice;

import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;

import ohos.aafwk.content.Operation;
import ohos.agp.components.DirectionalLayout;
import ohos.agp.components.PositionLayout;
import ohos.agp.components.Text;
import ohos.agp.colors.RgbColor;
import ohos.agp.components.element.ShapeElement;
import ohos.rpc.RemoteException;

public class MainAbility2Slice extends AbilitySlice {
    public static Text text;

    private DirectionalLayout myLayout = new DirectionalLayout(this);

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        PositionLayout positionLayout = new PositionLayout(this);

        ShapeElement background = new ShapeElement();
//        background.setShape(ShapeElement.RECTANGLE);
        background.setRgbColor(new RgbColor(0xFFFFFFFF));
        positionLayout.setBackground(background);

        text = new Text(this);
        text.setTextSize(30);
        text.setTop(400);
        text.setLeft(200);
        text.setText("accept");
        positionLayout.addComponent(text);

        super.setUIContent(positionLayout);
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }

    private void acquireForm() throws RemoteException {
        Intent intent = new Intent();
        Operation operation = new Intent.OperationBuilder()
                .withDeviceId("")
                .withBundleName("ohos.formsupplier.ability")
                .withAbilityName("ohos.formsupplier.ability.FormAbility")
                .build();
        intent.setOperation(operation);

        // 获取Form的尺寸
    }


}
